// Time Tracker by Eric Nadeau (nado18@gmail.com)
// Copyright (C) 2007 by Eric Nadeau
// Distributed under the terms of the GNU General Public License (see GPL.txt)

package view;

import com.apple.eawt.*;

/**
 * @author nado18@gmail.com, on Dec 29, 2005
 */
public class MacintoshListener {
	protected Runnable quitRunner;
	
	public MacintoshListener(Runnable quitRunner) {
		this.quitRunner = quitRunner;
		Application app = Application.getApplication();
		
		app.addApplicationListener(new ApplicationAdapter() {
			public void handleQuit(ApplicationEvent ev) {
				quit();
			}

		});
	}

	protected void quit() {
		quitRunner.run();
	}
}
